
package system;

import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * Getting current Time and/or Date
 * @param datetime result
 * @param string String of time or date format. For example, "yyyy.MM.dd HH.mm.ss"
 * @author zem
 */
public class getTimeDate {
public String datetime;
  public getTimeDate(String string) {
        datetime=CurrentDateTime(string);
    }


    String CurrentDateTime(String dateFormat) {
    Calendar cal = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
    return sdf.format(cal.getTime());

  }

}